# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#

@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

set_and_check(OpenVINO_SOURCE_DIR "@OpenVINO_SOURCE_DIR@")

# Variables to export in plugin's projects

set(ov_options "@IE_OPTIONS@")
list(APPEND ov_options CMAKE_CXX_COMPILER_LAUNCHER CMAKE_C_COMPILER_LAUNCHER
                       CMAKE_CXX_LINKER_LAUNCHER CMAKE_C_LINKER_LAUNCHER
                       CMAKE_BUILD_TYPE CMAKE_SKIP_RPATH CMAKE_INSTALL_PREFIX
                       CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET
                       CPACK_GENERATOR)
file(TO_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}" cache_path)

message(STATUS "The following CMake options are exported from OpenVINO Developer package")
message(" ")
foreach(option IN LISTS ov_options)
    if(NOT DEFINED "${option}")
        load_cache("${cache_path}" READ_WITH_PREFIX "" ${option})
    endif()
    message("    ${option}: ${${option}}")
endforeach()
message(" ")

# activate generation of plugins.xml
set(ENABLE_PLUGINS_XML ON)

# for samples in 3rd party projects
if(ENABLE_SAMPLES)
    if("@gflags_FOUND@")
        set_and_check(gflags_DIR "@gflags_DIR@")
    else()
        set_and_check(gflags_DIR "@gflags_BINARY_DIR@")
    endif()
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
    # Disable warning as error for private components
    set(CMAKE_COMPILE_WARNING_AS_ERROR OFF)
endif()

#
# Content
#

find_dependency(IEDevScripts
                PATHS "${OpenVINO_SOURCE_DIR}/cmake/developer_package"
                NO_CMAKE_FIND_ROOT_PATH
                NO_DEFAULT_PATH)

find_dependency(OpenVINO
                PATHS "${CMAKE_CURRENT_LIST_DIR}"
                NO_CMAKE_FIND_ROOT_PATH
                NO_DEFAULT_PATH)

_ov_find_tbb()
_ov_find_pugixml()

foreach(component @openvino_export_components@)
    # TODO: remove legacy targets from some tests
    # string(FIND "${component}" "_legacy" index)
    # if (index EQUAL -1)
    include("${CMAKE_CURRENT_LIST_DIR}/ov_${component}_dev_targets.cmake")
    # endif()
endforeach()

# inherit OpenCV from main OpenVINO project if enabled
if ("@OpenCV_FOUND@")
    load_cache("${cache_path}" READ_WITH_PREFIX "" OpenCV_DIR)
    find_dependency(OpenCV)
endif()

#
# Extra Compile Flags
#

# don't fail on strict compilation options in 3rd party modules
ov_dev_package_no_errors()

# Don't threat deprecated API warnings as errors in 3rd party apps
ov_deprecated_no_errors()
